package com.liyuan.help_e;

import com.liyuan.help_e.model.News;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

public class DbPipeline_ implements Pipeline {
    @Override
    public void process(ResultItems resultItems, Task task) {
        if(resultItems.get("content")==null){
            return ;
        }
        News news = new News();
        news.setPublishTime(resultItems.get("publishTime"));
        news.setTitle(resultItems.get("title"));
        news.setUrl(resultItems.get("url"));
        news.setAuthor(resultItems.get("author"));
        news.setContent(resultItems.get("content"));
        news.setImageUrl(resultItems.get("imageUrl"));
        news.setReadCount(resultItems.get("readCount"));
//        newsDao.insertNews(news);
    }
}
